package com.douqu.game.core.e;



public enum ReturnMessage {

    BACKUP("1000", ""),
    SUCCESS("0000", "成功"),
    FAILURE("1111", "失败"),
    ILLEGAL("2222", "非法请求"),
    EMPTY_PARAM("3333", "空参数"),
    PARAM_ERROR("4444", "参数错误"),
    REPEAT_REQUEST("5555", "重复请求"),

    NICK_NAME_ILLEGAL("1001", "昵称长度不合法,不能注册"),
    ACCOUNT_ILLEGAL("1002", "账号输入错误"),
    PHONE_NUM_ILLEGAL("1003", "手机号码格式错误"),
    DEVICE_HAS_BAND_PHONE("1003", "该设备已经绑定手机号"),
    DEVICE_UN_EXIST("1003", "设备不存在"),
    PHONE_HAS_ALREADY_REGISTER("1003", "该手机号已经注册"),
    DEVICE_ID_NOT_NULL("1004", "设备号不能为空"),
    PASSWORD_NOT_EMPTY("1005", "密码不能为空"),
    PASSWORD_ERROR("1006", "密码错误"),
    SMS_CODE_ERROR("1004", "验证码错误"),
    UNREGISTER("1007", "未注册"),
    AUTH_FAILURE("1008", "三方认证失败"),
    SERVER_ID_ERROR("1010", "找不到服务器"),
    NICKNAME_EXITS("1011", "角色名称已存在"),
    THIS_SERVER_PLAYER_EXITS("1012", "该服务器下已存在角色"),
    NO_RECORD("1013", "角色记录不存在"),
    NO_CHANNEL("1014", "通道填写错误"),
    CDK_GROUP_FULL("1201", "CDK组已满（1-9）"),
    CDK_GROUP_NOT_FIND("1202", "CDK组不存在"),
    CDK_NOT_FIND_OR_EXPIRED("1203", "CDK不存在或者过期"),
    CDK_USE_MAX_COUNT("1204", "该组CDK使用达到最大量"),
    CDK_ALREADY_USE("1205", "CDK已经被使用"),
    CDK_NOT_OPEN("1206", "cdk还没开启使用"),
    CDK_SERVER_NOT_CONFORM("1207","cdk区服不符合"),
    CDK_ROLE_CREATETIME_LATE("1208","该cdk之允许新区账号使用"),
    CDK_ROLE_LEVEL_LOW("1209","角色等级过低"),
    CDK_PLATFORM_ERROR("1210","cdk平台不一致"),

    APPLY_COUNT_MAX("2001", "报名人数已满"),
    SERVER_IS_STARTED("2002", "服务器已经为开启状态"),

    PLATFORM_ERROR("3001","platform填写错误"),
    GAMENAME_ERROR("3002","gameName填写错误"),
    SERVERTYPE_ERROR("3003","serverType填写错误"),

    UPDATE_ACTIVITY_CONFIG_TIME_ERROR("4001", "此时不允许修改"),

    UPDATE_ACTIVITY_CONFIG_NET_ERROR("4002", "网络异常或文件目录不存在,请检查"),

    GM_NO_UPDATE_USERNAME("5001", "不允许修改GM用户名"),

    ORDER_NOT_EXIST("9001", "订单不存在"),
    RECHARGE_TYPE_ERROR("9002", "冲值方式错误")
    ;


    private String code;
    private String msg;

    ReturnMessage(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }




    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static String forCode(String code) {

        for (ReturnMessage errorMsg : ReturnMessage.values()) {
            if (errorMsg.code.equals(code)) {
                return errorMsg.msg;
            }
        }
        return null;
    }

    public static ReturnMessage forEnum(String code) {

        for (ReturnMessage errorMsg : ReturnMessage.values()) {
            if (errorMsg.code.equals(code)) {
                return errorMsg;
            }
        }
        return null;
    }

}

